{include file="header.htm" /}
<body class="bodystyle" style="overflow-y: scroll; cursor: default; -moz-user-select: inherit;">
<div id="append_parent"></div>
<div id="ajaxwaitid"></div>
<div class="page min-hg-c-15"> {include file="bar.htm" /}
  <form class="form-horizontal" id="post_form" action="{:weapp_url('MyLivechat/MyLivechat/index')}" method="post">
    <div class="ncap-form-default">
      <dl class="row">
        <dt class="tit">
          <label>调用方式</label>
        </dt>
        <dd class="opt">
          <label class="curpoin">
            <input id="tag_weapp1" name="tag_weapp" value="1" type="radio" {if condition="!isset($MyLivechat.tag_weapp) || $MyLivechat.tag_weapp eq 1"} checked="checked"{/if}>
            自动调用</label>
          &nbsp;
          <label class="curpoin">
            <input id="tag_weapp0" name="tag_weapp" value="2" type="radio" {if condition="isset($MyLivechat.tag_weapp) && $MyLivechat.tag_weapp eq 2"} checked="checked"{/if}>
            手工调用</label>
          <p class="notic">自动调用会默认绑定weapp模板标签，手工调用请参考使用指南的调用方法。</p>
        </dd>
      </dl>
      <dl class="row">
        <dt class="tit">
          <label>选择客服</label>
        </dt>
        <dd class="opt">
          <label class="curpoin">
            <input id="tag_weapp1" name="status" value="1" type="radio" {if condition="!isset($MyLivechat.is_kefu) || $MyLivechat.is_kefu eq 1"} checked="checked"{/if}>
            MyLivechat</label>
          &nbsp;
          <label class="curpoin">
            <input id="tag_weapp0" name="status" value="2" type="radio" {if condition="isset($MyLivechat.is_kefu) && $MyLivechat.is_kefu eq 2"} checked="checked"{/if}>
            Tawk.to</label>          
        </dd>
      </dl>
      <input type="hidden" name="is_kefu" id="is_kefu" value="{$MyLivechat.is_kefu|default=1}">
      <dl class="row" id="wechat" {if condition="!isset($MyLivechat.is_kefu) || $MyLivechat.is_kefu eq 1"}style="display: block;"{else/}style="display: none;"{/if}>
        <dt class="tit" style="width: 118px;">
          <label for="service_wechat">MyLivechat调用js</label>
        </dt>
        <dd class="opt">
          <textarea rows="10" cols="60" name="seo_myLivechat" id="seo_myLivechat" style="height: 120px;">{$MyLivechat.seo_myLivechat}</textarea>          
          <span class="err"></span>
          <p class="">还没有账号？<a href="https://mylivechat.com/register.aspx" target="_blank">前往Mylivechat官网注册</a></p>          
        </dd>
      </dl>
      <dl class="row" id="tawkto" {if condition="$MyLivechat.is_kefu eq 2"}style="display: block;"{else/}style="display: none;"{/if}>
        <dt class="tit" style="width: 118px;">
          <label for="service_wechat">Tawk.to调用js</label>
        </dt>
        <dd class="opt">
          <textarea rows="10" cols="60" name="seo_Tawkto" id="seo_Tawkto" style="height: 120px;">{$MyLivechat.seo_Tawkto}</textarea>          
          <span class="err"></span>
          <p class="">还没有账号？<a href="https://dashboard.tawk.to/signup" target="_blank">前往Tawk.to官网注册</a></span></p>          
        </dd>
      </dl>
      <div class="bot mt30">
        <input type="hidden" name="code" value="{$MyLivechat.code|default=$weappInfo.code}">
        <a href="JavaScript:void(0);" onClick="checkForm();" class="ncap-btn-big ncap-btn-green" id="submitBtn">确认提交</a> </div>
    </div>
  </form>
</div>
<script type="text/javascript">
    $(document).ready(function() {
        $('input[name="status"]').change(function() {
            var selectedValue = $(this).val();
            if(selectedValue==2){
                $('#tawkto').css('display','block');
                $('#wechat').css('display','none');
            }else{
                $('#tawkto').css('display','none');
                $('#wechat').css('display','block');
            }
            $('#is_kefu').val(selectedValue)
        });
    });
    // 判断输入框是否为空
    function checkForm(){          
        if($('input[name=is_kefu]').val() == 1){
            if($('#seo_myLivechat').val() == ''){
                showErrorMsg('请输入MyLivechat调用js');
                $('input[name=seo_myLivechat]').focus();
                return false;
            }
        }else{
            if($('#seo_Tawkto').val() == ''){
                showErrorMsg('请输入Tawk.to调用js');
                $('input[name=seo_Tawkto]').focus();
                return false;
            }
        }       
        layer_loading('正在处理');
        $('#post_form').submit();
    }
    function img_call_back(fileurl_tmp)
    {
        $("#wechat_logo_local").val(fileurl_tmp);
        $("#img_a_local").attr('href', fileurl_tmp);
        $("#img_i_local").attr('onmouseover', "layer_tips=layer.tips('<img src="+fileurl_tmp+" class=\\'layer_tips_img\\'>',this,{tips: [1, '#fff']});");
    }
</script> 
{include file="footer.htm" /} 
